<template>
  <div v-if="isLoading" class="loading-overlay">
    <div class="loading-content">
      <div class="loading-indicator">
        <img class="loading-indicator-img" src="@/assets/images/loading.png" alt="">
        <span style="margin-left: 5px">加载中...</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isLoading: true
    };
  },
  methods: {
    show() {
      this.isLoading = true;
    },
    hide() {
      this.isLoading = false;
    }
  }
};
</script>

<style scoped>
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000; /* 确保加载动画在其他内容之上 */
}

.loading-content {
  /* 这里可以添加你的加载动画样式 */
}

.loading-indicator {
  /* 例如，简单的文本加载指示器样式 */
  color: white;
  font-size: 14px;
  padding: 10px;
  background-color: #333;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  .loading-indicator-img{
    width: 30px;height: 30px;
    animation: rotate 2000ms linear infinite;
  }
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
</style>
